package interfaz.checkList;

import interfaz.Intro.MenuPrincipal;
import java.util.List;
import javax.swing.DefaultComboBoxModel;
import pojos.Areas;

/**
 *
 * @author Diego Andres Gomez Montesinos
 */
public class ConfigCheckList extends javax.swing.JDialog {

    CheckList checkList;
    List areas = MenuPrincipal.manAreas.getFullAreas();
    
    /** Creates new form ConfigCheckList */
    public ConfigCheckList(java.awt.Dialog parent) {
        super(parent);
        initComponents();
        configuraComboBox();
    }
    
    private void configuraComboBox() {
        DefaultComboBoxModel modelo = new DefaultComboBoxModel();
        areasComboBox.setEditable(false);
        for(int i = 0; i < areas.size(); i++) {
            modelo.addElement(((Areas) areas.get(i)).getNombreArea());
        }
        areasComboBox.setModel(modelo);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        areasComboBox = new javax.swing.JComboBox();
        botonRegresaAlMenu = new javax.swing.JButton();
        botonAplicaChecklist = new javax.swing.JButton();
        etiquetaSeleccioneAreaEvaluar = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        areasComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        areasComboBox.setName("areasComboBox"); // NOI18N

        botonRegresaAlMenu.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        botonRegresaAlMenu.setText("Regresa al Menú");
        botonRegresaAlMenu.setName("botonRegresaAlMenu"); // NOI18N
        botonRegresaAlMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonRegresaAlMenuActionPerformed(evt);
            }
        });

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance().getContext().getActionMap(ConfigCheckList.class, this);
        botonAplicaChecklist.setAction(actionMap.get("botonAplicaChecklistActionPerformed")); // NOI18N
        botonAplicaChecklist.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        botonAplicaChecklist.setText("Aplica Cuestionario");
        botonAplicaChecklist.setName("botonAplicaChecklist"); // NOI18N
        botonAplicaChecklist.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonAplicaChecklistActionPerformed(evt);
            }
        });

        etiquetaSeleccioneAreaEvaluar.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        etiquetaSeleccioneAreaEvaluar.setText("Seleccione el Area / Proceso a evaluar:");
        etiquetaSeleccioneAreaEvaluar.setName("etiquetaSeleccioneAreaEvaluar"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(202, Short.MAX_VALUE)
                .addComponent(botonRegresaAlMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(177, Short.MAX_VALUE)
                .addComponent(botonAplicaChecklist, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(24, 24, 24))
            .addGroup(layout.createSequentialGroup()
                .addGap(31, 31, 31)
                .addComponent(etiquetaSeleccioneAreaEvaluar, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(32, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(20, Short.MAX_VALUE)
                .addComponent(areasComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 319, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addComponent(etiquetaSeleccioneAreaEvaluar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(areasComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(botonAplicaChecklist, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 48, Short.MAX_VALUE)
                .addComponent(botonRegresaAlMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void botonAplicaChecklistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonAplicaChecklistActionPerformed
    checkList = new CheckList(this, ((Areas) areas.get(areasComboBox.getSelectedIndex())).getIdArea());
    setVisible(false);
    checkList.setLocationRelativeTo(this);
    checkList.setVisible(true);
}//GEN-LAST:event_botonAplicaChecklistActionPerformed

private void botonRegresaAlMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonRegresaAlMenuActionPerformed
    setVisible(false);
    getOwner().setVisible(true);
}//GEN-LAST:event_botonRegresaAlMenuActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox areasComboBox;
    private javax.swing.JButton botonAplicaChecklist;
    private javax.swing.JButton botonRegresaAlMenu;
    private javax.swing.JLabel etiquetaSeleccioneAreaEvaluar;
    // End of variables declaration//GEN-END:variables
}
